//
//  MyCamera.h
//  IOTCamViewer
//
//  Created by Cloud Hsiao on 12/7/2.
//  Copyright (c) 2012年 TUTK. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <IOTCamera/Camera.h>

#import "LocalRecorder.h"

#import "defines.h"

#define BDG_MODE_DEFAULT_INDEX      0
#define BDG_MODE_ONEKEY_INDEX       1
#define BDG_MODE_HOME_INDEX         2
#define BDG_MODE_STORE_INDEX        3
#define BDG_MODE_USER_INDEX         4
#define BDG_MODE_DEVICE_INDEX       5

@protocol MyCameraDelegate;

@interface MyCamera : Camera <CameraDelegate>
{
    id<MyCameraDelegate> delegate2;
    id<MyCameraDelegate> delegate3;
    id<MyCameraDelegate> delegate4;
    
    NSInteger lastChannel;
    NSInteger remoteNotifications;
    NSMutableArray *arrayStreamChannel;
    NSString *viewAcc;
    NSString *viewPwd;
#if defined(P2PNETCAM_HAIER)
    NSString *viewPos;
#endif
#if defined(P2PMENBOSHI) || defined(P2PBANDIANGOU) || defined(P2PXBROBOT)
    //NSInteger orgArming;
    //NSInteger newArming;
#endif
    LocalRecorder *cameraLocalRecorder;
    
    BOOL bIsSupportTimeZone;
    int nGMTDiff;
    NSString* strTimeZone;
}

@property (nonatomic, retain) id<MyCameraDelegate> delegate2;
@property (nonatomic, retain) id<MyCameraDelegate> delegate3;
@property (nonatomic, retain) id<MyCameraDelegate> delegate4;

/** type **/
@property(nonatomic,assign)NSUInteger cameraType;
/** nickname **/
@property(nonatomic,copy) NSString *nickname;
/** password **/
@property(nonatomic,copy) NSString *password;

@property NSInteger lastChannel;
@property (readonly) NSInteger remoteNotifications;
@property (nonatomic, copy) NSString *viewAcc;
@property (nonatomic, copy) NSString *viewPwd;

@property (nonatomic, retain) LocalRecorder *cameraLocalRecorder;

@property (nonatomic, assign) BOOL bIsSupportTimeZone;
@property (nonatomic, assign) int nGMTDiff;
@property (nonatomic, copy) NSString* strTimeZone;

//#if defined(P2PMENBOSHI) || defined(P2PBANDIANGOU) || defined(P2PPETWANT) || defined(P2PXBROBOT)
#if 1
@property NSInteger orgArming;
@property NSInteger newArming;

@property NSInteger isPushMode;
@property NSInteger isNewPushMode;
@property (nonatomic, copy) NSString *pushSoundName;

@property (nonatomic, copy) NSString *deviceType;
@property NSInteger isAddServerSuccess;
@property (nonatomic, copy) NSString *deviceID;

@property NSInteger newVersionFlag;
@property NSInteger isReadNewVersionFlag;

@property NSInteger isWrongPassword;

@property NSInteger isProcessRemoteServer;


@property NSInteger currentEventType;
@property NSInteger currentEventTime;
#endif

#if defined(P2PPETWANT) || defined(P2PONTIPS)
@property (nonatomic, copy) NSString *petid;
#endif

#if defined(P2PONTIPS)
@property (nonatomic, copy) NSString *authority;
@property (nonatomic, copy) NSString *panelphone;
@property (nonatomic, copy) NSString *adminphone;
#endif

#if defined(AUDIO_TO_SUPPORT)
@property BOOL isRecvAudioFormat;
#endif

#if defined(DEV_LIST_CONTRL) || defined(P2PVIDEODB)
@property NSInteger orgContrlValue1;
@property NSInteger newContrlValue1;
#endif

@property NSInteger orgModeValue1;
@property NSInteger newModeValue1;
@property BOOL isShowListView;

@property (nonatomic, retain) NSMutableArray *externalDeviceListArr;

#if defined(P2PNETCAM_HAIER)
@property (nonatomic, copy) NSString *viewPos;
- (id)initWithName:(NSString *)name viewAccount:(NSString *)viewAcc viewPassword:(NSString *)viewPwd viewPosition:(NSString *)viewPos;
#else
- (id)initWithName:(NSString *)name viewAccount:(NSString *)viewAcc viewPassword:(NSString *)viewPwd;
#endif


- (void)start:(NSInteger)channel;
#ifdef LIB_140210
- (void)start4EventPlayback:(NSInteger)channel;
#endif

- (void)setRemoteNotification:(NSInteger)type EventTime:(long)time;
- (void)clearRemoteNotifications;
- (NSArray *)getSupportedStreams;
- (BOOL)getAudioInSupportOfChannel:(NSInteger)channel;
- (BOOL)getAudioOutSupportOfChannel:(NSInteger)channel;
- (BOOL)getPanTiltSupportOfChannel:(NSInteger)channel;
- (BOOL)getEventListSupportOfChannel:(NSInteger)channel;
- (BOOL)getPlaybackSupportOfChannel:(NSInteger)channel;
- (BOOL)getWiFiSettingSupportOfChannel:(NSInteger)channel;
- (BOOL)getMotionDetectionSettingSupportOfChannel:(NSInteger)channel;
- (BOOL)getRecordSettingSupportOfChannel:(NSInteger)channel;
- (BOOL)getFormatSDCardSupportOfChannel:(NSInteger)channel;
- (BOOL)getVideoFlipSupportOfChannel:(NSInteger)channel;
- (BOOL)getEnvironmentModeSupportOfChannel:(NSInteger)channel;
- (BOOL)getMultiStreamSupportOfChannel:(NSInteger)channel;
- (NSInteger)getAudioOutFormatOfChannel:(NSInteger)channel;
- (BOOL)getVideoQualitySettingSupportOfChannel:(NSInteger)channel;
- (BOOL)getDeviceInfoSupportOfChannel:(NSInteger)channel;

- (BOOL)getDeviceUpgradeOnlineSupportOfChannel:(NSInteger)channel;
- (BOOL)getDevicePTZSupportOfChannel:(NSInteger)channel;
- (BOOL)getDeviceRestorySupportOfChannel:(NSInteger)channel;
- (BOOL)getDeviceRebootSupportOfChannel:(NSInteger)channel;
- (BOOL)getDeviceIRCutSupportOfChannel:(NSInteger)channel;

- (BOOL)getPWDeviceLowProfileSupportOfChannel:(NSInteger)channel;

@end

@protocol MyCameraDelegate <NSObject>
@optional
- (void)camera:(MyCamera *)camera _didReceiveRemoteNotification:(NSInteger)eventType EventTime:(long)eventTime;
- (void)camera:(MyCamera *)camera _didReceiveRawDataFrame:(const char *)imgData VideoWidth:(NSInteger)width VideoHeight:(NSInteger)height;
- (void)camera:(MyCamera *)camera _didReceiveJPEGDataFrame:(const char *)imgData DataSize:(NSInteger)size;
- (void)camera:(MyCamera *)camera _didReceiveFrameInfoWithVideoWidth:(NSInteger)videoWidth VideoHeight:(NSInteger)videoHeight VideoFPS:(NSInteger)fps VideoBPS:(NSInteger)videoBps AudioBPS:(NSInteger)audioBps OnlineNm:(NSInteger)onlineNm FrameCount:(unsigned long)frameCount IncompleteFrameCount:(unsigned long)incompleteFrameCount;
- (void)camera:(MyCamera *)camera _didChangeSessionStatus:(NSInteger)status;
- (void)camera:(MyCamera *)camera _didChangeChannelStatus:(NSInteger)channel ChannelStatus:(NSInteger)status;
- (void)camera:(MyCamera *)camera _didReceiveIOCtrlWithType:(NSInteger)type Data:(const char*)data DataSize:(NSInteger)size;
@end

extern BOOL g_bDiagnostic;
